<?php

class Casecheck extends MY_Controller {

    var $data = null;
    var $module = null;
    var $controller = null;
    var $url = null;
    var $table = "";
    var $submodule = null;
    

    /* @ Set Constructor  */

    public function __construct() {
        parent::__construct();
        $this->data['module'] = $this->module = $this->uri->segment(1);
        $this->data['URLPATH_IMAGES'] = URLPATH_MOD . 'modules/' . $this->module . "/asset/images/";
        $this->data['URLPATH_JS'] = URLPATH_MOD . 'modules/' . $this->module . "/asset/js/";
        $this->data['URLPATH_CSS'] = URLPATH_MOD . 'modules/' . $this->module . "/asset/css/";
        $this->data['sub_module'] = $this->submodule = $this->router->class;

        // load model
        $this->load->model($this->submodule . '_model', 'model');

        $this->plugColorbox(); // เรียกใช้ colorbox 
        // user test 
        
  
        $this->data['userdata'] = array('username' => 'jnthongluk', 'em_code' => '00202929');
        $this->data['leftmenu'] = $this->leftMenu();
        $this->setCSS($this->data['URLPATH_CSS'].'default.css');
        $this->setCSS(base_url().'assets/css/grid/grid.css');
        
        //set CSS
        // set JSS
    }

    /* @ Load Default */

    public function index() {

  $this->load->model('igrid_model', 'igrid');
        $sql = $this->model->mt_casecheck(null, 1, 1);
        $x = new Igrid_model('',10);
        $x->showCheckboxes(true);
       $x->setQuery2($sql, 'ca_runno', "ca_runno:ASC", '');
        $x->setColumnHeader('ca_tname', 'ชื่อ', Igrid_model::TYPE_HREF,
        $this->BASE_URL . $this->submodule . "/%ca_runno%");
        
//        $x->addStandardControl(Igrid_model::STDCTRL_DELETE,
//                "tblDelete('%CO_RUNNO%')");
        

        if (isset($_POST['page'])) {
           echo $x->printTable();
            
            exit;
        } else {
            $this->data['grid'] = $x->printTable();
            
        }

        $this->data['content'] = $this->load->view("index_view", $this->data,
                true);
        $this->load->view("default", $this->data);
    }
    
 
    
    public function leftMenu(){
        $str = "
            <ul id='box-left-menu'>
                <li>xxxxx</li>
            </ul>
            ";
        return $str;
        
    }
    

    public function add() {
        
    }

    public function update() {
        
    }

    public function delete() {
        
    }

}

?>